/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JButton;
import javax.swing.JOptionPane;

import com.metier.UsersMetier;

/**
 *
 * @author massaer
 */
public class PanelMonCompte extends javax.swing.JPanel implements KeyListener, ActionListener{

    /**
     * Creates new form PanelMonCompte
     */
    public PanelMonCompte() {
        //initComponents();
    }
    public PanelMonCompte(JButton b1,JButton b2){
    	initComponents(b1,b2);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents(JButton boutonMesProjets,JButton boutonMesConges) {

        jPanel1 = new javax.swing.JPanel();
        jPanel1.setBackground(new java.awt.Color(128, 130, 133));
        boutonGeneral = new javax.swing.JButton();
        //boutonMesProjets = new javax.swing.JButton();
        //boutonMesConges = new javax.swing.JButton();
        labelNom = new javax.swing.JLabel();
        labelNom.setForeground(new java.awt.Color(255, 255, 255));
        labelNom.setFont(new java.awt.Font("Verdana", 3, 14));
        labelPrenom = new javax.swing.JLabel();
        labelPrenom.setFont(new java.awt.Font("Verdana", 3, 14));
        labelPrenom.setForeground(new java.awt.Color(255, 255, 255));
        labelLogin = new javax.swing.JLabel();
        labelLogin.setFont(new java.awt.Font("Verdana", 3, 14));
        labelLogin.setForeground(new java.awt.Color(255, 255, 255));
        labelEmail = new javax.swing.JLabel();
        labelEmail.setFont(new java.awt.Font("Verdana", 3, 14));
        labelEmail.setForeground(new java.awt.Color(255, 255, 255));
        labelPhone = new javax.swing.JLabel();
        labelPhone.setFont(new java.awt.Font("Verdana", 3, 14));
        labelPhone.setForeground(new java.awt.Color(255, 255, 255));
        labelAdresse = new javax.swing.JLabel();
        labelAdresse.setFont(new java.awt.Font("Verdana", 3, 14));
        labelAdresse.setForeground(new java.awt.Color(255, 255, 255));
        panelPhotoProfil = new javax.swing.JPanel();
        panelPhotoProfil.setBackground(new java.awt.Color(128, 130, 133));
        labelProfil = new javax.swing.JLabel();
        labelProfil.setForeground(new java.awt.Color(255, 255, 255));
        boutonModifier = new javax.swing.JButton();
        boutonModifier.setFont(new java.awt.Font("Verdana", 3, 14));
        boutonValider = new javax.swing.JButton();
        boutonValider.setFont(new java.awt.Font("Verdana", 3, 14));
        boutonAnnuler = new javax.swing.JButton();
        boutonAnnuler.setFont(new java.awt.Font("Verdana", 3, 14));
        textPassword = new javax.swing.JLabel();
        textPassword.setFont(new java.awt.Font("Verdana", 3, 14));
        textNom = new javax.swing.JTextField();
        textNom.setFont(new java.awt.Font("Verdana", 3, 12));
        textNom.setSize(8, 4);
        textPrenom = new javax.swing.JTextField();
        textPrenom.setFont(new java.awt.Font("Verdana", 3, 12));
        textLogin = new javax.swing.JTextField();
        textLogin.setFont(new java.awt.Font("Verdana", 3, 12));
        textEmail = new javax.swing.JTextField();
        textEmail.setFont(new java.awt.Font("Verdana", 3, 12));
        textProfil = new javax.swing.JTextField();
        textProfil.setFont(new java.awt.Font("Verdana", 3, 12));
        textPhone = new javax.swing.JTextField();
        textPhone.setFont(new java.awt.Font("Verdana", 3, 12));
        textAdresse = new javax.swing.JTextField();
        textAdresse.setFont(new java.awt.Font("Verdana", 3, 12));
        textAncienPassword = new javax.swing.JPasswordField();
        textAncienPassword.setFont(new java.awt.Font("Verdana", 3, 12));
        labelNewPassword = new javax.swing.JLabel();
        labelNewPassword.setForeground(new java.awt.Color(255, 255, 255));
        textNewPassword = new javax.swing.JPasswordField();
        textNewPassword.setFont(new java.awt.Font("Verdana", 3, 12));
        labelPhoto = new javax.swing.JLabel();
        labelPhoto.setIcon(new javax.swing.ImageIcon("src/main/java/com/photos/profil.gif"));
        
        boutonModifier.addActionListener(this);
        boutonValider.addActionListener(this);
        boutonAnnuler.addActionListener(this);
        boutonMesConges.addActionListener(this);
        boutonMesProjets.addActionListener(this);
        boutonGeneral.addActionListener(this);
        textAncienPassword.addKeyListener(this);
        textNom.addKeyListener(this);
        textPrenom.addKeyListener(this);
        textPhone.addKeyListener(this);
        textAdresse.addKeyListener(this);

        setMaximumSize(new java.awt.Dimension(1050, 550));
        setMinimumSize(new java.awt.Dimension(1050, 550));
        setSize(1050, 550);
        setBackground(new java.awt.Color(128, 130, 133));
        setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 0, 0)));
        
        //jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 0, 0)));

        boutonGeneral.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        boutonGeneral.setText("GENERAL");

        boutonMesProjets.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        boutonMesProjets.setText("MES PROJETS");

        boutonMesConges.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        boutonMesConges.setText("MES CONGES");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(204, 204, 204)
                .addComponent(boutonGeneral)
                .addGap(66, 66, 66)
                .addComponent(boutonMesProjets)
                .addGap(78, 78, 78)
                .addComponent(boutonMesConges)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(14, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(boutonGeneral)
                    .addComponent(boutonMesProjets)
                    .addComponent(boutonMesConges))
                .addContainerGap())
        );

        labelNom.setFont(new java.awt.Font("Verdana", 3, 14));// NOI18N
        labelNom.setText("Nom");

        labelPrenom.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        labelPrenom.setText("Prenom");

        labelLogin.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        labelLogin.setText("Login");

        labelEmail.setFont(new java.awt.Font("Verdana", 3, 14));// NOI18N
        labelEmail.setText("Email");

        labelPhone.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        labelPhone.setText("Phone");

        labelAdresse.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        labelAdresse.setText("Adresse");

        javax.swing.GroupLayout panelPhotoProfilLayout = new javax.swing.GroupLayout(panelPhotoProfil);
        panelPhotoProfil.setLayout(panelPhotoProfilLayout);
        panelPhotoProfilLayout.setHorizontalGroup(
            panelPhotoProfilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 179, Short.MAX_VALUE)
        );
        panelPhotoProfilLayout.setVerticalGroup(
            panelPhotoProfilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 319, Short.MAX_VALUE)
        );

        labelProfil.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        labelProfil.setText("Profil");

        boutonModifier.setText("Modifier");

        boutonValider.setText("Valider");

        boutonAnnuler.setText("Annuler");

        textPassword.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        textPassword.setText("Ancien Password");
        textPassword.setForeground(new java.awt.Color(255, 255, 255));

        textPhone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textPhoneActionPerformed(evt);
            }
        });

        labelNewPassword.setFont(new java.awt.Font("Verdana", 3, 14)); // NOI18N
        labelNewPassword.setText("Nouveau Password");
        labelNewPassword.setForeground(new java.awt.Color(255, 255, 255));

        labelPhoto.setIcon(new javax.swing.ImageIcon("src/main/java/com/photos/profil.gif")); // NOI18N
        labelPhoto.setText("Photo Profil");
        labelPhoto.setFont(new java.awt.Font("Verdana", 3, 14)); 

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(68, 68, 68)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(textPassword)
                        .addGap(70, 70, 70)
                        .addComponent(textAncienPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelNom)
                            .addComponent(labelPrenom)
                            .addComponent(labelLogin)
                            .addComponent(labelEmail)
                            .addComponent(labelProfil)
                            .addComponent(labelPhone)
                            .addComponent(labelAdresse))
                        .addGap(126, 126, 126)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textNom)
                            .addComponent(textPrenom)
                            .addComponent(textLogin)
                            .addComponent(textEmail)
                            .addComponent(textProfil)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(textPhone, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(textAdresse, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 279, Short.MAX_VALUE)
                        .addComponent(panelPhotoProfil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelPhoto, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(62, 62, 62))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(67, 67, 67)
                        .addComponent(labelNewPassword)
                        .addGap(41, 41, 41)
                        .addComponent(textNewPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(421, 421, 421)
                        .addComponent(boutonModifier)
                        .addGap(52, 52, 52)
                        .addComponent(boutonValider)
                        .addGap(53, 53, 53)
                        .addComponent(boutonAnnuler)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panelPhotoProfil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(37, 37, 37)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(labelNom)
                                    .addComponent(textNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(labelPrenom)
                                    .addComponent(textPrenom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(labelLogin)
                                    .addComponent(textLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(23, 23, 23)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(labelEmail)
                                    .addComponent(textEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(textProfil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelProfil))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(textPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelPhone))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(textAdresse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelAdresse))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(textAncienPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(textPassword)
                                    .addComponent(labelNewPassword)
                                    .addComponent(textNewPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(labelPhoto)
                                .addGap(40, 40, 40)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(boutonModifier)
                    .addComponent(boutonValider)
                    .addComponent(boutonAnnuler))
                .addGap(106, 106, 106))
        );
    }// </editor-fold>                        

    private void textPhoneActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }                                         

    // Variables declaration - do not modify                     
    private javax.swing.JButton boutonAnnuler;
    private javax.swing.JButton boutonGeneral;
    private javax.swing.JButton boutonMesConges;
    private javax.swing.JButton boutonMesProjets;
    private javax.swing.JButton boutonModifier;
    private javax.swing.JButton boutonValider;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel labelAdresse;
    private javax.swing.JLabel labelEmail;
    private javax.swing.JLabel labelLogin;
    private javax.swing.JLabel labelNewPassword;
    private javax.swing.JLabel labelNom;
    private javax.swing.JLabel labelPhone;
    private javax.swing.JLabel labelPhoto;
    private javax.swing.JLabel labelPrenom;
    private javax.swing.JLabel labelProfil;
    private javax.swing.JPanel panelPhotoProfil;
    private javax.swing.JTextField textAdresse;
    private javax.swing.JPasswordField textAncienPassword;
    private javax.swing.JTextField textEmail;
    private javax.swing.JTextField textLogin;
    private javax.swing.JPasswordField textNewPassword;
    private javax.swing.JTextField textNom;
    private javax.swing.JLabel textPassword;
    private javax.swing.JTextField textPhone;
    private javax.swing.JTextField textPrenom;
    private javax.swing.JTextField textProfil;
    private String[] tab= new String[6];
    // End of variables declaration    
	public javax.swing.JButton getBoutonAnnuler() {
		return boutonAnnuler;
	}

	public void setBoutonAnnuler(javax.swing.JButton boutonAnnuler) {
		this.boutonAnnuler = boutonAnnuler;
	}

	public javax.swing.JButton getBoutonGeneral() {
		return boutonGeneral;
	}

	public void setBoutonGeneral(javax.swing.JButton boutonGeneral) {
		this.boutonGeneral = boutonGeneral;
	}

	public javax.swing.JButton getBoutonMesConges() {
		return boutonMesConges;
	}

	public void setBoutonMesConges(javax.swing.JButton boutonMesConges) {
		this.boutonMesConges = boutonMesConges;
	}

	public javax.swing.JButton getBoutonMesProjets() {
		return boutonMesProjets;
	}

	public void setBoutonMesProjets(javax.swing.JButton boutonMesProjets) {
		this.boutonMesProjets = boutonMesProjets;
	}

	public javax.swing.JButton getBoutonModifier() {
		return boutonModifier;
	}

	public void setBoutonModifier(javax.swing.JButton boutonModifier) {
		this.boutonModifier = boutonModifier;
	}

	public javax.swing.JButton getBoutonValider() {
		return boutonValider;
	}

	public void setBoutonValider(javax.swing.JButton boutonValider) {
		this.boutonValider = boutonValider;
	}

	public javax.swing.JPanel getjPanel1() {
		return jPanel1;
	}

	public void setjPanel1(javax.swing.JPanel jPanel1) {
		this.jPanel1 = jPanel1;
	}

	public javax.swing.JLabel getLabelAdresse() {
		return labelAdresse;
	}

	public void setLabelAdresse(javax.swing.JLabel labelAdresse) {
		this.labelAdresse = labelAdresse;
	}

	public javax.swing.JLabel getLabelEmail() {
		return labelEmail;
	}

	public void setLabelEmail(javax.swing.JLabel labelEmail) {
		this.labelEmail = labelEmail;
	}

	public javax.swing.JLabel getLabelLogin() {
		return labelLogin;
	}

	public void setLabelLogin(javax.swing.JLabel labelLogin) {
		this.labelLogin = labelLogin;
	}

	public javax.swing.JLabel getLabelNewPassword() {
		return labelNewPassword;
	}

	public void setLabelNewPassword(javax.swing.JLabel labelNewPassword) {
		this.labelNewPassword = labelNewPassword;
	}

	public javax.swing.JLabel getLabelNom() {
		return labelNom;
	}

	public void setLabelNom(javax.swing.JLabel labelNom) {
		this.labelNom = labelNom;
	}

	public javax.swing.JLabel getLabelPhone() {
		return labelPhone;
	}

	public void setLabelPhone(javax.swing.JLabel labelPhone) {
		this.labelPhone = labelPhone;
	}

	public javax.swing.JLabel getLabelPhoto() {
		return labelPhoto;
	}

	public void setLabelPhoto(javax.swing.JLabel labelPhoto) {
		this.labelPhoto = labelPhoto;
	}

	public javax.swing.JLabel getLabelPrenom() {
		return labelPrenom;
	}

	public void setLabelPrenom(javax.swing.JLabel labelPrenom) {
		this.labelPrenom = labelPrenom;
	}

	public javax.swing.JLabel getLabelProfil() {
		return labelProfil;
	}

	public void setLabelProfil(javax.swing.JLabel labelProfil) {
		this.labelProfil = labelProfil;
	}

	public javax.swing.JPanel getPanelPhotoProfil() {
		return panelPhotoProfil;
	}

	public void setPanelPhotoProfil(javax.swing.JPanel panelPhotoProfil) {
		this.panelPhotoProfil = panelPhotoProfil;
	}

	public javax.swing.JTextField getTextAdresse() {
		return textAdresse;
	}

	public void setTextAdresse(javax.swing.JTextField textAdresse) {
		this.textAdresse = textAdresse;
	}

	public javax.swing.JPasswordField getTextAncienPassword() {
		return textAncienPassword;
	}

	public void setTextAncienPassword(javax.swing.JPasswordField textAncienPassword) {
		this.textAncienPassword = textAncienPassword;
	}

	public javax.swing.JTextField getTextEmail() {
		return textEmail;
	}

	public void setTextEmail(javax.swing.JTextField textEmail) {
		this.textEmail = textEmail;
	}

	public javax.swing.JTextField getTextLogin() {
		return textLogin;
	}

	public void setTextLogin(javax.swing.JTextField textLogin) {
		this.textLogin = textLogin;
	}

	public javax.swing.JPasswordField getTextNewPassword() {
		return textNewPassword;
	}

	public void setTextNewPassword(javax.swing.JPasswordField textNewPassword) {
		this.textNewPassword = textNewPassword;
	}

	public javax.swing.JTextField getTextNom() {
		return textNom;
	}

	public void setTextNom(javax.swing.JTextField textNom) {
		this.textNom = textNom;
	}

	public javax.swing.JLabel getTextPassword() {
		return textPassword;
	}

	public void setTextPassword(javax.swing.JLabel textPassword) {
		this.textPassword = textPassword;
	}

	public javax.swing.JTextField getTextPhone() {
		return textPhone;
	}

	public void setTextPhone(javax.swing.JTextField textPhone) {
		this.textPhone = textPhone;
	}

	public javax.swing.JTextField getTextPrenom() {
		return textPrenom;
	}

	public void setTextPrenom(javax.swing.JTextField textPrenom) {
		this.textPrenom = textPrenom;
	}

	public javax.swing.JTextField getTextProfil() {
		return textProfil;
	}

	public void setTextProfil(javax.swing.JTextField textProfil) {
		this.textProfil = textProfil;
	}

	public void keyPressed(KeyEvent e) {
		// TODO Auto-generated method stub
		if (e.getSource()==textAncienPassword){
			textNewPassword.setEnabled(true);
		}
		if (e.getSource()==textNom){
			if (textNom.getText().length()>15){
				textNom.setText("");
				JOptionPane.showMessageDialog(null, "Ce champs ne doit pas dépasser 15 caractères !");
			}		
		}
		if (e.getSource()==textPrenom){
			if (textPrenom.getText().length()>15){
				textPrenom.setText("");
				JOptionPane.showMessageDialog(null, "Ce champs ne doit pas dépasser 15 caractères !");
			}		
		}
		if (e.getSource()==textPhone){
			if (textPhone.getText().length()>8){
				textPhone.setText("");
				JOptionPane.showMessageDialog(null, "Ce champs ne doit contenir que 9 caractères !");
			}		
		}
		if (e.getSource()==textAdresse){
			if (textAdresse.getText().length()>15){
				textAdresse.setText("");
				JOptionPane.showMessageDialog(null, "Ce champs ne doit pas dépasser 15 caractères !");
			}		
		}
	}

	public void keyReleased(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	public void keyTyped(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if (e.getSource()==boutonModifier){
			
				tab[0]=textNom.getText();
				tab[1]=textPrenom.getText();
				tab[2]=textAdresse.getText();
				tab[3]=textPhone.getText();
				tab[4]=textAncienPassword.getText();
				tab[5]=textNewPassword.getText();
			
			textPassword.setVisible(true);
			labelNewPassword.setVisible(true);
			textAncienPassword.setVisible(true);
			textNewPassword.setVisible(true);
			textNewPassword.setEnabled(false);
			textNom.setEditable(true);
			textPrenom.setEditable(true);
			//textLogin.setEditable(true);
			textAdresse.setEditable(true);
			textPhone.setEditable(true);
			boutonAnnuler.setEnabled(true);
			boutonValider.setEnabled(true);
			boutonModifier.setEnabled(false);
			textAncienPassword.setText("");
			textNewPassword.setText("");
		}
		if (e.getSource()==boutonAnnuler){
			
			textNom.setText(tab[0]);
			textPrenom.setText(tab[1]);
			textAdresse.setText(tab[2]);
			textPhone.setText(tab[3]);
			
			textPassword.setVisible(false);
			labelNewPassword.setVisible(false);
			textAncienPassword.setVisible(false);
			textNewPassword.setVisible(false);
			textNom.setEditable(false);
			textPrenom.setEditable(false);
			textLogin.setEditable(false);
			textAdresse.setEditable(false);
			textPhone.setEditable(false);
			boutonValider.setEnabled(false);
			boutonModifier.setEnabled(true);
			boutonAnnuler.setEnabled(false);
		}
		if (e.getSource()==boutonValider){
			   if (comparaison(textNewPassword.getText(),tab[5])&&(!comparaison(textAncienPassword.getText(),""))){
				   JOptionPane.showMessageDialog(null, "Veuillez remplir le nouveau password !");
			   }
	
		   else
			   if(comparaison(textNom.getText(),tab[0])&& comparaison(textPrenom.getText(),tab[1])&&
					   comparaison(textAdresse.getText(),tab[2])&& comparaison(textPhone.getText(), tab[3])&&
					   comparaison(textAncienPassword.getText(),""))
		   {
				   JOptionPane.showMessageDialog(null, "Aucune modification n'a été faite !");
		   }
			   else
				   if(comparaison(textNom.getText(), "")|| comparaison(textPrenom.getText(),"")||
						   comparaison(textPhone.getText(),"")){
					   JOptionPane.showMessageDialog(null, "Certains champs sont obligatoires !");
				   }
				   else
					   if (comparaison(textAncienPassword.getText(),"")){
						   UsersMetier usersMetier= new UsersMetier();
						   usersMetier.modifierCompteSansPassword(textLogin.getText(), textPhone.getText(), textAdresse.getText());
						   JOptionPane.showMessageDialog(null, "Modification réussie !");
						   textPassword.setVisible(false);
							labelNewPassword.setVisible(false);
							textAncienPassword.setVisible(false);
							textNewPassword.setVisible(false);
							textNom.setEditable(false);
							textPrenom.setEditable(false);
							textLogin.setEditable(false);
							textAdresse.setEditable(false);
							textPhone.setEditable(false);
							boutonValider.setEnabled(false);
							boutonModifier.setEnabled(true);
							boutonAnnuler.setEnabled(false);
					   }
					   else{
						   UsersMetier usersMetier= new UsersMetier();
						   if(usersMetier.modifierCompte(textLogin.getText(),
								   textPhone.getText(), textAdresse.getText(), textAncienPassword.getText(),
								   textNewPassword.getText())){
							   JOptionPane.showMessageDialog(null, "Modification réussie !");
						   }
						   else
							   JOptionPane.showMessageDialog(null, "Ancien mot de passe incorrect !");
					   }
		}
		if (e.getSource()==boutonMesProjets){
			
		}
	}
    
	private boolean comparaison(String chaine1, String chaine2) {
		boolean ok = false;
		if (chaine1.equals(chaine2))
			ok = true;
		else {
			if (chaine1.length() == chaine2.length())
				ok = false;
			else {
				int i = 0;
				if (chaine1.length() < chaine2.length()) {
					while (!(ok) && (i < chaine1.length())) {
						ok = chaine1.charAt(i) == chaine2.charAt(i);
						i++;
					}
					if (i == chaine1.length())
						while (!(ok) && (i < chaine2.length())) {
							ok = chaine2.charAt(i) == ' ';
							i++;
						}
				}
				if (chaine1.length() > chaine2.length()) {
					while (!(ok) && (i < chaine2.length())) {
						ok = chaine2.charAt(i) == chaine1.charAt(i);
						i++;
					}
					if (i == chaine2.length())
						while (!(ok) && (i < chaine1.length())) {
							ok = chaine1.charAt(i) == ' ';
							i++;
						}
				}
			}
		}
		return ok;
	}
}
